<template>
	<view class="box">
		<view class="sort">
			<picker :range="array" :value="index" @change="bindPickSort">
				<view class="select">
					<view>{{array[index]}}</view>
					<view class="image">
						<image style="width: 100%;height: 100%;" src="../../static/xiajiantou.png" mode=""></image>
					</view>
				</view>
			</picker>
		</view>
		<view class="list">
			<view class="list_item" @click="gotoStore(item.id)" v-for="(item,index) in rechnicianlist" :key="index">
				<view class="img">
					<image :src="imageurl + item.image" mode=""></image>
				</view>
				<view class="list_content">
					<text class="shopName">{{item.name}}</text>
					<text class="Grade">{{item.score}}</text>
					<view class="label">
						<text>{{item.level}}</text>
						<text>从业{{item.workTime}}年</text>
						<text>预约{{item.orderNum}}次</text>
					</view>
					<text class="jieshao">擅长:{{item.skill}}</text>

				</view>
				<view :class="item.status==1?'distance':'distances'">
					{{item.status==1?'预约':'不可预约'}}
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	var app = getApp()
	export default {
		data() {
			return {
				array: ['非盲人技师', '盲人技师'],
				index: 1,
				page: 1, //页数
				rechnicianlist: [], //技师列表
				imageurl:this.$imgurl,
			}
		},
		onLoad() {
			console.log('店铺id', app.globalData.shopid)
			this.gettechnician()

		},
		methods: {
			//获取技师列表
			gettechnician() {
				var that = this
				 var value = uni.getStorageSync('orderData');
				var data = {
					isBlind: that.index==1?true:false,
					storeId: 1, //app.globalData.shopid
					orderData:value,
				}
				var http = '/api/user/store/getMassagistListByMulConditions/?limit=' + 20 + '&page=' + that.page
				that.$http(http, 'POST', data).then((res) => {
					console.log('返回参数', res.data.data.list)
					that.rechnicianlist = res.data.data.list
				})
			},
			//技师详情
			gotoStore(id) {
				uni.navigateTo({
					url: "../technicianDetail/technicianDetail?id=" + id
				})
			},
			bindPickSort: function(e) {
				console.log('picker发送选择改变，携带值为', e.target.value)
				this.index = e.target.value
				this.gettechnician()
			}
		}
	}
</script>

<style lang="scss">
	.box {
		width: 750rpx;

		.sort {
			padding: 20rpx;
			border-bottom: 1rpx solid #f3f3f3;

			.select {
				display: flex;
				align-items: center;

				.image {
					width: 30rpx;
					height: 30rpx;
					margin-left: 10rpx;
				}
			}

		}

		.list {
			width: 750rpx;
			margin-top: 20rpx;

			.list_item {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 10rpx;
				padding: 20rpx 20rpx;
				font-size: 25rpx;
				box-sizing: border-box;
				border-bottom: 1rpx solid #F2F2F2;

				.list_content {
					position: relative;
					display: flex;
					flex-direction: column;
					justify-content: center;
					width: 435rpx;

					.shopName {
						font-weight: bold;
						font-size: 30rpx;
					}

					.Grade {
						display: inline-block;
						position: absolute;
						width: 120rpx;
						top: 0;
						left: 150rpx;
						text-align: center;
						-webkit-border-radius: 10px;
						border-radius: 20rpx;
						font-weight: bold;
						font-size: 20rpx;
						/* background-color: red; */
						// color: red;
					}

					.jieshao {
						color: rgba(127, 127, 127, 0.91);
						font-size: 24rpx;
					}

					.label {
						color: #FF3333;
					}

					.address {
						overflow: hidden;
						text-overflow: ellipsis;
						max-height: 434rpx;
						height: 91rpx;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
						word-break: break-all;
						word-wrap: break-word;
					}
				}

				.distance {
					width: 112rpx;
					height: 40rpx;
					background-color: #f49c1c;
					border-radius: 50rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					color: #FFFFFF;
				}

				.distances {
					width: 112rpx;
					height: 40rpx;
					background-color: #C0C4CC;
					border-radius: 50rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					color: #FFFFFF;
				}

				.img {
					width: 120rpx;
					height: 120rpx;

					image {
						width: 100%;
						height: 100%;
						border-radius: 50%;
					}
				}
			}
		}
	}
</style>
